package com.itheima.morning.demo02;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class AnnoDemo {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {
        Class clazz = Class.forName("com.itheima.morning.demo02.UserTest");
        Method[] methods = clazz.getDeclaredMethods();

        @SuppressWarnings(value = "all")
        UserTest userTest = (UserTest) clazz.newInstance();

        for (Method method : methods) {
            if (method.isAnnotationPresent(Test.class)) {
                method.invoke(userTest);
            }
        }
    }
}
